package com.idrem.views.visit;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.baidu.mapapi.BMapManager;
import com.baidu.mapapi.GeoPoint;
import com.baidu.mapapi.ItemizedOverlay;
import com.baidu.mapapi.LocationListener;
import com.baidu.mapapi.MKGeneralListener;
import com.baidu.mapapi.MKLocationManager;
import com.baidu.mapapi.MapActivity;
import com.baidu.mapapi.MapController;
import com.baidu.mapapi.MapView;
import com.baidu.mapapi.MyLocationOverlay;
import com.baidu.mapapi.OverlayItem;
import com.idrem.R;
import com.idrem.common.Common;
import com.idrem.common.MySharedPreferences;

//import com.idrem.dao.db.DatabaseHelper;

public class VisitMapAct extends MapActivity implements LocationListener {
	private List<HashMap<String, Object>> list_nei = new ArrayList();
	private List<HashMap<String, Object>> list_wai = new ArrayList();
	private MapController mapController;
	private BMapManager mapManager;
	private MapView mapView;
	// private DatabaseHelper myHelper;
	private MKLocationManager myLocationManager;
	private MyLocationOverlay myLocationOverlay;
	private LinearLayout root;
	private String sql_nei = " select distinct a.cust_code,b.name,(case when c.visit_id is null then '0' else '1' end) visit_status,b.xx,b.yy,b.type   from UserRouteCust a  left join Customer b on b.code = a.cust_code and a.dms_id = a.dms_id  left join HistoryVisit c on a.cust_code = c.cust_code and c.dms_id = a.dms_id and date(c.start_time) = '" + Common.getNowDateStr() + "' " + " where date(a.route_date) = '" + Common.getNowDateStr() + "' " + " and a.dsr_code = '" + MySharedPreferences.getInstance(this).getDsrCode() + "'" + " and a.dms_id = '" + MySharedPreferences.getInstance(this).getDmsId() + "'" + " order by a.cust_code ";
	private String sql_wai = " select distinct code,name,(case when b.visit_id is null then '0' else '1' end) visit_status,a.xx,a.yy ,a.type    from Customer a     left join HistoryVisit b on a.code = b.cust_code and b.dms_id = a.dms_id and date(b.start_time) = '" + Common.getNowDateStr() + "'   " + "  where a.code not in (select cust_code from UserRouteCust where date(route_date) = '" + Common.getNowDateStr() + "'  and dms_id = '" + MySharedPreferences.getInstance(this).getDmsId() + "' )   " + "  and a.dms_id = '" + MySharedPreferences.getInstance(this).getDmsId() + "' " + " order by a.code  ";
	private View window;

	private void initPopview() {
		this.window = super.getLayoutInflater().inflate(2130903125, null);
		this.mapView.addView(this.window, new MapView.LayoutParams(-2, -2, null, 51));
		this.window.setVisibility(window.GONE);
	}

	private void setData(String paramString, List<HashMap<String, Object>> paramList) {
		// get men dian location and set it.
	}

	protected void onCreate(Bundle paramBundle) {
		super.onCreate(paramBundle);
		setContentView(R.layout.visitmap);
		// init my localtion
	}

	public void onLocationChanged(Location arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}
}